using System;
using NUnit.Framework;
using ElevatorSpeeches.Framework;
using ElevatorSpeeches.Framework.Tests;

namespace ElevatorSpeeches.Tests
{
    [TestFixture]
	public class UserControllerTestCase : BaseControllerTest
    {
        ElevatorSpeeches.Controllers.UserController _userController = new ElevatorSpeeches.Controllers.UserController();

        [Test]
        public void UserControllerTest()
        {
            
            User user = TestModelFactory.GetUser();
            user.Name = Guid.NewGuid().ToString().Substring(0,16);
			
            // TODO: find out how to init controller so flahs is instantiated.
			_userController.InitializeControllerState(String.Empty, "UserControler", "Registration");
			_userController.RenderView("Registration");
            _userController.Registration(user);
						
            Assert.Greater(user.ID, 0); 

            User user2 = User.GetAuthenticatedUser(user.Name, TestModelFactory.USER_PASSWORD);
						
            Assert.AreEqual(user.Email, user2.Email);
        }
        
    }
}
